
from time import sleep
from selenium import webdriver
from selenium.webdriver import ActionChains
from selenium.webdriver.common.by import By

# # 1.打开浏览器
# driver = webdriver.Chrome() #创建浏览器对象
# # 2.输入访问地址（URL）
# driver.get("http://121.43.169.97:8848/pageA.html")
# # 放大浏览器页面
# driver.maximize_window()
#
# # 实例化并获取ActionChains类
# action = ActionChains(driver)
#
# # 定位用户名 在用户名上 右击鼠标
# # username = driver.find_element_by_css_selector("#userA")
# # # 调用右击方法
# # cc = action.context_click(username)
# # # 执行
# # cc.perform()
#
#
# action.context_click(driver.find_element_by_css_selector("#userA")).perform()
#
#
# # 输入用户名admin，
# # username2 = driver.find_element_by_css_selector("#userA").send_keys("admin")
# username2 = driver.find_element_by_css_selector("#userA")
# username2.send_keys("admin")
# # 暂停3秒钟后
# sleep(3)
# # 双击鼠标左键，选中admin
# dc = action.double_click(username2)
# dc.perform()
#
# # 鼠标移动到'注册按钮'， 预期：按钮变色
# button = driver.find_element_by_xpath("//p[5]/button")
# action.move_to_element(button).perform()


